package com.sk.bilibili.other;

import java.util.HashMap;

public class JsonMap extends HashMap<String,Object> {

    @Override
    public Object put(String key, Object value) {
        put(key.split("\\."),0,value);
        return value;
    }

    private void put(String[] items,int index,Object value){
        if(index<items.length-1){
            if(!containsKey(items[index])){
                super.put(items[index],new JsonMap());
            }
            ((JsonMap)get(items[index])).put(items,index+1,value);
        }else {
            super.put(items[index],value);
        }
    }

}